function childrenDel(diarycontent){
    var protocol = window.location.protocol;
    var host = window.location.host;
    var examineUser = $("#spanUserName").text();
    var role = $("#p1").text();
    var examineStatusSize = $("#examineStatusSize").text();
    if (examineStatusSize == 0){
        document.getElementById("examineStatusSize").style.display = "none";
    }
    var DelChildrenSize = $("#DelChildrenSize").text();
    if (DelChildrenSize == 0){
        document.getElementById("DelChildrenSize").style.display = "none";
    }
    if (role == 1){
        var id = diarycontent;
        layer.prompt({
            formType: 2,
            value: ' ',
            title: '请输入删除的理由',
            area: ['400px', '50px'] //自定义文本域宽高
        }, function(value, index, elem){
            if (value == " "){
                layer.open({
                    title: '提示信息',
                    anim: 0,
                    resize:false,//是否可以拉伸  默认true
                    icon: 2,
                    shadeClose: true,
                    skin: 'layui-layer-molv',
                    content: "删除理由不能为空！"
                });
            }else {
                var reason = value;
                $.ajax({
                    type : 'POST',
                    url : '/childrenDelete',
                    data : {id:id,examineUser:examineUser,reason:reason},
                    success:function (data) {

                        if (data == "OK"){
                            layer.msg('提交成功', {
                                icon: 1,
                                shadeClose: true,
                                skin: 'layui-layer-molv',
                                time: 2000 //2秒关闭（如果不配置，默认是3秒）
                            }, function(){
                                window.location.href = window.location.href;
                            });
                        }else {
                            layer.open({
                                title: '提示信息',
                                anim: 0,
                                resize:false,//是否可以拉伸  默认true
                                icon: 2,
                                shadeClose: true,
                                skin: 'layui-layer-molv',
                                content: data
                            });
                        }
                    },
                    error: function (e) {
                        console.log(e)
                    }
                });
            }
            layer.close(index);
        });
    }
    else {
        layer.confirm('确定要删除吗?',
            {icon: 3, title: '系统提示'},
            function (index) {
                var id = diarycontent;
                $.ajax({
                    type : 'POST',
                    url : '/childrenDelete',
                    data : {id:id,examineUser:examineUser},
                    success:function (data) {

                        if (data == "OK"){
                            layer.msg('删除成功', {
                                icon: 1,
                                shadeClose: true,
                                skin: 'layui-layer-molv',
                                time: 2000 //2秒关闭（如果不配置，默认是3秒）
                            }, function(){
                                window.location.href = window.location.href;
                            });
                        }else {
                            layer.open({
                                title: '提示信息',
                                anim: 0,
                                resize:false,//是否可以拉伸  默认true
                                icon: 2,
                                shadeClose: true,
                                skin: 'layui-layer-molv',
                                content: data
                            });
                        }
                    },
                    error: function (e) {
                        console.log(e)
                    }
                });
                layer.close(index);
            });
    }


}

function childrenDel2(){
    var checks = new Array();
    var examineUser = $("#spanUserName").text();
    checks = $('input[type="checkbox"]:checked').map(function(){

        return $(this).val();

    }).get()
    console.log(checks);
    var protocol = window.location.protocol;
    var host = window.location.host;
    if (checks.length == 0){
        layer.open({
            title: '提示信息',
            anim: 0,
            resize:false,//是否可以拉伸  默认true
            icon: 2,
            shadeClose: true,
            skin: 'layui-layer-molv',
            content: "请至少选中一行数据进行操作"
        });
    }else {
        layer.confirm('确定要删除吗?',{icon: 3, title: '系统提示'}, function(index){
            for (var i = 0;i<checks.length;i++){
                var id = checks[i];
                $.ajax({
                    type : 'POST',
                    url : '/childrenDelete',
                    data : {id:id,examineUser:examineUser},
                    success:function (data) {
                        if (data == "OK"){
                            window.location.href = window.location.href;
                        }else {
                            layer.open({
                                title: '提示信息',
                                anim: 0,
                                resize:false,//是否可以拉伸  默认true
                                icon: 2,
                                shadeClose: true,
                                skin: 'layui-layer-molv',
                                content: data
                            });
                        }
                    },
                    error: function (e) {
                        console.log(e)
                    }
                });

            }
            layer.close(index);
        });
    }
}